Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poly: Hardcode barrett multiplier #806

Merged
merged 1 commit into from
Feb 25, 2025
Merged

Poly: Hardcode barrett multiplier #806

merged 1 commit into from
Feb 25, 2025

Conversation

hanno-becker
Copy link
Contributor

In most places in the code, we use magic constants with check-magic: ... annotations explaining their origin, rather than computing the magic constant in the code and relying on constant evaluation by the compiler.

One place where this was not done is barrett_reduce(), where the 'magic' Barrett multiplier was computed in C.

This commit aligns barrett_reduce() to other routines relying on magic constants, by hardcoding the magic value in C, and adding a check-magic: ... annotation to explain its origin.

In most places in the code, we use magic constants with
`check-magic: ...` annotations explaining their origin,
rather than computing the magic constant in the code
and relying on constant evaluation by the compiler.

One place where this was not done is `barrett_reduce()`,
where the 'magic' Barrett multiplier was computed in C.

This commit aligns `barrett_reduce()` to other routines
relying on magic constants, by hardcoding the magic value
in C, and adding a `check-magic: ...` annotation to explain
its origin.

Signed-off-by: Hanno Becker <beckphan@amazon.co.uk>
@hanno-becker hanno-becker requested a review from a team as a code owner February 25, 2025 07:11
@mkannwischer mkannwischer merged commit 50beac5 into main Feb 25, 2025
180 checks passed
@mkannwischer mkannwischer deleted the barret_magic branch February 25, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants